package com.markerhub.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.markerhub.common.lang.Result;
import com.markerhub.entity.AppBlueLabel;
import com.markerhub.entity.AppGroupType;
import com.markerhub.entity.AppUserSetting;
import com.markerhub.mapper.AppBlueLabelMapper;
import com.markerhub.service.AppGroupTypeService;
import com.markerhub.mapper.AppGroupTypeMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 *
 */
@Service
public class AppGroupTypeServiceImpl extends ServiceImpl<AppGroupTypeMapper, AppGroupType>
        implements AppGroupTypeService {

    @Override
    public int insertGroup(AppGroupType mAppGroupType) {
        AppGroupType result = this.getOne(new QueryWrapper<AppGroupType>()
                .eq("group_area", mAppGroupType.getGroupArea())
                .eq("group_name", mAppGroupType.getGroupName()
                ));
        if (result != null) {
            return 0;
        }else{
            baseMapper.insert(mAppGroupType);
            return 1;
        }


    }

    @Override
    public Object pageAdmin(Page page, AppGroupType appOrder) {
        return mAppBlueLabelMapper.pageWithUsername(page, appOrder);
    }

    @Resource
    AppGroupTypeMapper mAppBlueLabelMapper;




}




